// 基于template/src/widgets/\{{appEntities}}/\{{ctrls@PANEL}}-panel/\{{spinalCase ctrl.codeName}}-panel-model.ts.hbs生成
import { IPanelModel } from '@/core';
function getModel(): IPanelModel {
    return {
        cssName: "{{#if ctrl.psSysCss}}{{ctrl.psSysCss.cssName}}{{/if}}",             
        caption: '{{ctrl.caption}}',
        controlType: '{{ctrl.controlType}}',
        codeName: '{{ctrl.codeName}}',
        entityCodeName: '{{ctrl.psAppDataEntity.codeName}}',
        name: '{{ctrl.name}}',
        noSort: '{{ctrl.noSort}}',
        sortDir: '{{ctrl.minorSortDir}}',
        limit: {{#if ctrl.pagingSize}}{{ctrl.pagingSize}}{{else}}1000{{/if}}, 
        dataMode: {{ctrl.dataMode}},
        layoutMode: "{{ctrl.layoutMode}}",
        rootLayoutDetailNames: [
            {{~#if ctrl.rootPSPanelItems~}}
            {{~#each ctrl.rootPSPanelItems as | panelItem |~}}
            "{{panelItem.name}}"{{#unless @last}},{{/unless}}
            {{~/each~}}
            {{~/if~}}
        ],
        layoutItems: getLayoutItems(),   
    }
}

function getLayoutItems() {
    return {
{{#if ctrl.rootPSPanelItems}}
    {{#each ctrl.rootPSPanelItems as | panelItem | }}
        {{> @macro/widgets/panel-detail/include-panel.hbs type="PANELDETAILSMODEL" item=panelItem panelType="ITEMLAYOUT"}}
    {{/each}}
{{/if}}
    }
}

export const model = getModel();